package Concurrent.countDownLatch.wait.latch;

import java.util.concurrent.CountDownLatch;

/**
 * Created by wangyg6 on 2017/11/29.
 */
public class TaskOne implements Runnable {
	private CountDownLatch latch;

	public TaskOne(CountDownLatch latch) {
		this.latch = latch;
	}

	@Override
	public void run() {
		try {
			Thread.sleep((long) (Math.random() * 1000));
			System.out.println("Task one execute complete");
			latch.countDown();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
